package com.jinandi.app.dao;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import com.jinandi.app.domain.Role;

public interface RoleDao extends PagingAndSortingRepository<Role, Integer>, JpaSpecificationExecutor<Role>{

	/**
	 * <根据userId 删除 user与角色的关系>
	 * @param uid
	 * @author CGC 
	 * 创建日期:2013-5-9 下午1:38:53
	 */
	@Modifying
	@Query("delete from Role r where r.user.id = ?1")
	@Transactional
	void deleteRoleByUserId(Long uid);

}
